package maxinshiSomeipTool20.common.itfSafeSWT;

import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;

/** 场景基类（纯抽象，不涉及具体业务） */
public abstract class BaseScene {
    protected Composite rootContainer;

    public abstract void init(Composite parent);
    protected abstract String getSceneTitle();
    protected abstract void initSceneControls();
    protected abstract void bindEvents();

    public void clear() {
        if (rootContainer != null && !rootContainer.isDisposed()) {
            for (Control child : rootContainer.getChildren()) {
                if (!child.isDisposed()) {
                    child.dispose();
                }
            }
            rootContainer.dispose();
        }
    }

    protected Composite getRootContainer() {
        return rootContainer;
    }
}